﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCLHJiaJiaSLInfoQS.ascx.cs" Inherits="Web.Controls.UCLHJiaJiaSLInfoQS" %>
<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<script type="text/javascript">
    //$(function () {

    //});
    function GetValue(type) {
        if (type == 'bh') {
            return UCLHUserInfo_hdCollection.Get("bh");
        }
        else {
            return "";
        }
    }
    function UCLHUserInfo_txtBHKeyPress() {
        if (event.keyCode == 13) {
            setTimeout(function () {

            }, 0);
            event.preventDefault ? event.preventDefault() : (event.returnValue = false);
            if (UCLHUserInfo_txtYongHuH.GetText() == '') {
                alert('请输入用户号。');
                UCLHUserInfo_txtYongHuM.SetText("");
                UCLHUserInfo_txtKCJHYUAN.SetText("");
                UCLHUserInfo_txtKCJHXIN.SetText("");
                UCLHUserInfo_txtHGJHYUAN.SetText("");
                UCLHUserInfo_txtKCLSJ.SetText("");
                UCLHUserInfo_txtHGLSJ.SetText("");
                UCLHUserInfo_txtCJHL.SetText("");
                UCLHUserInfo_txtJJL.SetText("");
                UCLHUserInfo_txtTZL.SetText("");
                UCLHUserInfo_txtYongHuH.Focus();
                return;
            }
            UCLHUserInfo_ASPxCallback1.PerformCallback("bh");
        }
    }
    //水量年切换事件
    function yChange()
    {
        //清除当前用户信息
        UCLHUserInfo_txtYongHuM.SetText("");
        UCLHUserInfo_txtKCJHYUAN.SetText("");
        UCLHUserInfo_txtKCJHXIN.SetText("");
        UCLHUserInfo_txtHGJHYUAN.SetText("");
        UCLHUserInfo_txtKCLSJ.SetText("");
        UCLHUserInfo_txtHGLSJ.SetText("");
        UCLHUserInfo_txtCJHL.SetText("");
        UCLHUserInfo_txtJJL.SetText("");
        UCLHUserInfo_txtTZL.SetText("");
    }
    //调整量变更事件
    function tzlChange(s)
    {
        if (event.keyCode != 13) {           
            if (UCLHUserInfo_txtTZL.GetText() == "") {
                UCLHUserInfo_txtJJL.SetText(UCLHUserInfo_txtCJHL.GetText());
            }
            else if (!isAllNum(UCLHUserInfo_txtTZL.GetText()))
            {
                GetInt(s);
                UCLHUserInfo_txtJJL.SetText(UCLHUserInfo_txtCJHL.GetText());
            }
            else {
                UCLHUserInfo_txtJJL.SetText(parseInt(UCLHUserInfo_txtCJHL.GetText()) - parseInt(UCLHUserInfo_txtTZL.GetText()));
            }
        }
    }
    function addToList()
    {
        if (UCLHUserInfo_txtYongHuH.GetText() == "" || UCLHUserInfo_txtYongHuM.GetText()=="")
        {
            alert("请先查出用户的加价信息。");
            return;
        }
        if (UCLHUserInfo_txtCJHL.GetText()=="")
        {
            alert("该用户无超计划量,无需调整。");
            return;
        }
        if (UCLHUserInfo_txtTZL.GetText() == "" || UCLHUserInfo_txtTZL.GetText()=="0") {
            alert("请输入正确的调整量。");
            return;
        }
        if (parseInt(UCLHUserInfo_txtTZL.GetText()) > parseInt(UCLHUserInfo_txtCJHL.GetText())) {
            alert("调整量应小于超计划量。");
            return;
        }
        UCLHUserInfo_btnActPerform.onClick();
    }
    function UCLHUserInfo_ASPxCallbackCommonComplete(rs) {
        var arr = rs.split('|');
        var type = arr[0];
        var state = arr[1];
        var specialIdentity = arr[2];
        var msg = arr[3].split('-');
        if (msg[0] == 'True') {
            alert(msg[1]);
        }
        UCLHUserInfo_hdCollection.Set("type", type);
        if (state == 'True') {
            if (type == "bh") {
                //加载信息
                UCLHUserInfo_txtYongHuM.SetText(arr[4]);
                UCLHUserInfo_txtKCJHYUAN.SetText(arr[5]);
                UCLHUserInfo_txtKCJHXIN.SetText(arr[6]);
                UCLHUserInfo_txtHGJHYUAN.SetText(arr[7]);
                UCLHUserInfo_txtKCLSJ.SetText(arr[8]);
                UCLHUserInfo_txtHGLSJ.SetText(arr[9]);
                UCLHUserInfo_txtCJHL.SetText(arr[10]);
                UCLHUserInfo_txtJJL.SetText(0);//默认显示调整后
                UCLHUserInfo_txtTZL.SetText(arr[11]);
                UCLHUserInfo_txtTZL.Focus();
            }
        }
    }   

</script>
 <div style="display:none;">
                <dx:ASPxButton ID="btnActPerform" ClientInstanceName="UCLHUserInfo_btnActPerform" runat="server" Text="ASPxButton" OnClick="btnActPerform_Click"></dx:ASPxButton>
                    </div>
<dx:ASPxHiddenField ID="hdCollection" ClientInstanceName="UCLHUserInfo_hdCollection" runat="server"></dx:ASPxHiddenField>
<dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="UCLHUserInfo_ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){UCLHUserInfo_ASPxCallbackCommonComplete(e.result);}"></dx:ASPxCallback>
<fieldset style="border: 1px solid  cornflowerblue;width:97%;margin:auto;">
    <legend><b>加价水量调整信息</b></legend>
    <table style="width:80%;margin:auto;">
        <tr>
            <td align="right" style="width: 20%">登记文号：
            </td>
            <td style="width: 25%">
                <dx:ASPxTextBox ID="txtLaiHanBH" ReadOnly="true" runat="server" Width="100%" Text=""></dx:ASPxTextBox>
            </td>
            <td style="width: 20%;white-space:nowrap" align="right"><%--许可证编号：--%></td>
            <td style="width: 25%">
                 <dx:ASPxTextBox ID="txtXuKeZH" ReadOnly="true" runat="server" Width="100%" Text="" Visible="false"></dx:ASPxTextBox>
            </td>
            <td >                
            </td>
            <td></td>
        </tr>
        <tr>
            <td align="right" >水量年：
            </td>
            <td>
                <dx:ASPxComboBox ID="cmbY" ClientInstanceName="UCLHUserInfo_cmbY" runat="server" ValueType="System.String">
                    <ClientSideEvents SelectedIndexChanged="function(s,e){yChange();}" />
                </dx:ASPxComboBox>
            </td>
            <td align="right">
            </td>
            <td>
                
            </td>
            <td align="right">
            </td>
            <td>
                
            </td>
        </tr>
         <tr runat="server" id="trdj1">
            <td align="right">用户号：
            </td>
            <td>
                <dx:ASPxTextBox ID="txtYongHuH" ClientInstanceName="UCLHUserInfo_txtYongHuH" runat="server" Text="" Width="100%" ClientSideEvents-KeyPress="function(s,e){UCLHUserInfo_txtBHKeyPress();}"></dx:ASPxTextBox>
            </td>   
             <td colspan="4"></td>          
        </tr>
        <tr runat="server" id="trdj2">
            <td align="right">用户名：
            </td>
            <td colspan="5">
                <dx:ASPxTextBox ID="txtYongHuM" ClientInstanceName="UCLHUserInfo_txtYongHuM" runat="server" Text="" Width="99.5%"></dx:ASPxTextBox>
            </td>
        </tr>
        <tr runat="server" id="trdj3">
            <td align="right" >原采计划量：
            </td>            
            <td>
               <dx:ASPxTextBox ID="txtKCJHYUAN" ClientInstanceName="UCLHUserInfo_txtKCJHYUAN" runat="server" Text="" Width="99.5%"></dx:ASPxTextBox>
            </td>
            <td align="right">
            </td>
            <td>
                
            </td>
            <td align="right">
            </td>
            <td>
                
            </td>
        </tr>
        <tr runat="server" id="trdj4">
            <td align="right" >现采计划量：
            </td>                
            <td>
               <dx:ASPxTextBox ID="txtKCJHXIN" ClientInstanceName="UCLHUserInfo_txtKCJHXIN" runat="server" Text="" Width="99.5%"></dx:ASPxTextBox>
            </td>
            <td align="right">
                回灌计划量：
            </td>
            <td>
                <dx:ASPxTextBox ID="txtHGJHYUAN" ClientInstanceName="UCLHUserInfo_txtHGJHYUAN" runat="server" Text="" Width="99.5%"></dx:ASPxTextBox>
            </td>
            <td align="right">
            </td>
            <td>
                
            </td>
        </tr>
        <tr runat="server" id="trdj5">
            <td align="right" >实际开采量：
            </td>                
            <td>
               <dx:ASPxTextBox ID="txtKCLSJ" ClientInstanceName="UCLHUserInfo_txtKCLSJ" runat="server" Text="" Width="99.5%"></dx:ASPxTextBox>
            </td>
            <td align="right">
                实际回灌量：
            </td>
            <td>
                <dx:ASPxTextBox ID="txtHGLSJ" ClientInstanceName="UCLHUserInfo_txtHGLSJ" runat="server" Text="" Width="99.5%"></dx:ASPxTextBox>
            </td>
            <td align="right">
            </td>
            <td>
                
            </td>
        </tr>
        <tr runat="server" id="trdj6">
            <td align="right" >超计划量：
            </td>                
            <td>
               <dx:ASPxTextBox ID="txtCJHL" ClientInstanceName="UCLHUserInfo_txtCJHL" runat="server" Text="" Width="99.5%"></dx:ASPxTextBox>
            </td>
            <td align="right">
                调整后加价量：
            </td>
            <td>
                <dx:ASPxTextBox ID="txtJJL" ClientInstanceName="UCLHUserInfo_txtJJL" runat="server" Text="" Width="99.5%"></dx:ASPxTextBox>
            </td>
            <td align="right">
                
            </td>
            <td>
                
            </td>
        </tr>
        <tr runat="server" id="trdj7">
            <td align="right" >调整量：
            </td>                
            <td>
               <dx:ASPxTextBox ID="txtTZL" ClientInstanceName="UCLHUserInfo_txtTZL" runat="server" Text="" Width="99.5%">
                   <ClientSideEvents  KeyUp="function(s,e){tzlChange(s);}" KeyPress="function(s,e){if(event.keyCode == 13){addToList();}}"/>
               </dx:ASPxTextBox>
            </td>
            <td align="right">
                <dx:ASPxButton ID="btnAdd" runat="server" Text="添加"  UseSubmitBehavior="false" AutoPostBack="false">
                    <ClientSideEvents  Click="function(s,e){addToList();}"/>
                </dx:ASPxButton>
            </td>
            <td>
            </td>
            <td align="right">
            </td>
            <td>
                
            </td>
        </tr>
    </table>
</fieldset>
